package com.example.module_marketers


import android.util.Log
import androidx.activity.viewModels
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.lib_common.view.BaseMvvmActivity
import com.example.module_marketers.databinding.ActivityResidencyApplicationDetailBinding
import com.example.module_marketers.viewmodel.MarketersViewModel
/**
 * 智慧园区-04-商家推荐V1.1-张亦婷-20250512
 */
@Route(path = "/module_marketers/residencyApplicationDetailActivity")
class ResidencyApplicationDetailActivity : BaseMvvmActivity<ActivityResidencyApplicationDetailBinding>() {
    @Autowired
    @JvmField
    var detailId:Int=0
    private val viewModel: MarketersViewModel by viewModels()

    override fun initViews() {
        super.initViews()
        ARouter.getInstance().inject(this)
        Log.d("id","${detailId}")
        viewModel.getResidencyApplicationDetailById(detailId)
        binding.back.setOnClickListener {
            finish()
        }
        binding.statusBar.setOnClickListener {
            ARouter.getInstance().build("/module_marketers/marketersActivity")
                .withInt("marketId", detailId)
                .navigation()
        }
    }
    override fun observeDataChange() {
        viewModel.getResidencyApplicationDetailByIdSuccess.observe(this){
            binding.detailEntity=it
            binding.applyTime.setText(it.processingSteps.get(0).stepTime)
        }
    }
    override fun onResume() {
        super.onResume()
        viewModel.getResidencyApplicationDetailById(detailId)
    }
    override fun getLayoutId(): Int =R.layout.activity_residency_application_detail
}